/* 全局背景色使用主题变量 */
html {
  background-color: var(--theme-bg-primary);
}

body {
  background-color: var(--theme-bg-primary);
  color: var(--theme-text-primary);
}

html,body,#root,.ka-wrapper,.ka-content{
    padding: 0;
    margin: 0;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
}

/* 页面切换时的默认背景 */
#root {
  background-color: var(--theme-bg-primary);
  min-height: 100vh;
}

/* 路由切换时的过渡效果 */
.ka-wrapper, .ka-content {
  background-color: var(--theme-bg-secondary);
  transition: opacity 0.2s ease-in-out;
}
p {
  margin: 0;
  padding: 0;
}

.warp{
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    width: 100%;
    font-size: 16px;
    .header{
        width: 100%;
        height: 50px;
    }
    .content{
        flex: 1;
        overflow-y: scroll;
        background-color: var(--theme-bg-secondary);
    }
    .footer{
        width: 100%;
        min-height: 50px;
    }
}
:root:root {
  --adm-color-primary: var(--theme-primary);
}

/* 深色主题全局样式 */
.dark-theme {
  background-color: var(--theme-bg-secondary);
  color: var(--theme-text-primary);
  
  .adm-nav-bar {
    background-color: var(--theme-bg-secondary);
    color: var(--theme-text-primary);
  }
  
  .adm-search-bar {
    --background: var(--theme-bg-input);
    --color: var(--theme-text-primary);
    --placeholder-color: var(--theme-text-muted);
  }
  
  .adm-input-element {
    color: var(--theme-text-primary) !important;
    background-color: transparent !important;
    
    &::placeholder {
      color: var(--theme-text-muted) !important;
    }
    
    &:focus {
      color: var(--theme-text-primary) !important;
    }
  }
  
  .adm-search-bar-cancel {
    color: var(--theme-text-primary) !important;
  }
  
  .adm-search-bar-clear {
    color: var(--theme-text-muted) !important;
  }
  
  .adm-popover {
    --background: var(--theme-bg-input);
    --color: var(--theme-text-primary);
  }
  
  .adm-list {
    background-color: var(--theme-bg-secondary);
  }
  
  .adm-pull-to-refresh {
    background-color: var(--theme-bg-secondary);
  }
}

/* 强制覆盖Ant Design X Sender组件文字颜色 */
.ant-sender .ant-sender-input,
.ant-sender input,
.ant-sender textarea {
  color: var(--theme-text-primary) !important;
}

.ant-sender .ant-sender-input::placeholder,
.ant-sender input::placeholder,
.ant-sender textarea::placeholder {
  color: var(--theme-text-muted) !important;
}

.ant-sender .ant-sender-input:focus,
.ant-sender input:focus,
.ant-sender textarea:focus {
  color: var(--theme-text-primary) !important;
}

/* 强制覆盖Ant Design Mobile输入框文字颜色 */
.adm-input-element,
.adm-input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea {
  color: var(--theme-text-primary) !important;
}

.adm-input-element::placeholder,
.adm-input::placeholder,
input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder,
input[type="tel"]::placeholder,
input[type="url"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
  color: var(--theme-text-muted) !important;
}

.adm-input-element:focus,
.adm-input:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus {
  color: var(--theme-text-primary) !important;
}

/* 强制覆盖Ant Design X Bubble组件背景色 */
.ant-bubble-content-filled {
  background-color: var(--theme-bg-card) !important;
  color: var(--theme-text-primary) !important;
  font-size: 14px !important;
}

/* AI消息样式（左侧） */
.ant-bubble[data-placement="start"] .ant-bubble-content-filled {
  background-color: var(--theme-bg-card) !important;
  color: var(--theme-text-primary) !important;
  font-size: 14px !important;
  border-radius: 18px 18px 18px 4px !important;
}

/* 用户消息样式（右侧） */
.ant-bubble[data-placement="end"] .ant-bubble-content-filled {
  background-color: var(--theme-primary-light) !important;
  color: var(--theme-text-primary) !important;
  font-size: 14px !important;
  border-radius: 18px 18px 4px 18px !important;
}

/* HeaderNav 返回确认弹窗样式 - 统一全局样式 */
.header-nav-dialog {
  .adm-dialog {
    background: linear-gradient(135deg, var(--theme-bg-card) 0%, var(--theme-bg-input) 100%) !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: var(--theme-shadow-lg) !important;
    overflow: hidden !important;
    position: relative !important;
  }
  
  .adm-dialog-content {
    color: var(--theme-text-primary) !important;
    font-size: 16px !important;
    padding: 24px !important;
    text-align: center !important;
    line-height: 1.5 !important;
  }
  
  .adm-dialog-button {
    color: var(--theme-text-primary) !important;
    font-weight: 500 !important;
    font-size: 16px !important;
    height: 48px !important;
    border: none !important;
    background: transparent !important;
    border-radius: 10px !important;
    margin: 0 16px 8px 16px !important;
    width: calc(100% - 32px) !important;
    
    &:active {
      background-color: rgba(255, 255, 255, 0.05) !important;
    }
    
    // 确定按钮样式（主题色背景）
    &:last-child {
      background: var(--theme-primary) !important;
      color: var(--theme-text-primary) !important;
      font-weight: 600 !important;
      margin-bottom: 16px !important;
      
      &:active {
        background: var(--theme-primary-dark) !important;
      }
    }
    
    // 取消按钮样式（透明背景）
    &:first-child {
      color: var(--theme-text-muted) !important;
      background: var(--theme-bg-input) !important;
      border: none !important;
      
      &:active {
        background-color: rgba(255, 255, 255, 0.05) !important;
      }
    }
  }
  
  .adm-dialog-button-wrapper {
    border-top: none !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    background: transparent !important;
  }
  
  .adm-center-popup-body {
    background-color: var(--theme-bg-primary);
    color: var(--theme-text-primary) !important;
  }
  
  .adm-dialog-body {
    padding: 0 !important;
  }
  
  .adm-center-popup-wrap {
    background-color: transparent !important;
  }
}

.adm-dialog-footer {
  .adm-dialog-action-row {
    display: block !important;
    border: none !important;
  }
}

.adm-center-popup {
  --background-color: var(--theme-bg-card) !important;
}

/* CustomToast (导入成功/失败等提示) 弹窗样式 */
.custom-toast-dialog {
  .adm-dialog {
    background: var(--theme-bg-card) !important;
    border-radius: 16px !important;
    border: 1px solid var(--theme-border-primary) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    overflow: hidden !important;
  }
  
  .adm-dialog-body {
    background: var(--theme-bg-card) !important;
    padding: 0 !important;
  }
  
  .adm-dialog-content {
    background: transparent !important;
  }
  
  .adm-center-popup-body {
    background: var(--theme-bg-card) !important;
  }
}